﻿using System;
using System.IO;

namespace PlaylistEditorForCentrafuse.Logging
{
	public class LogFile
	{
		private StreamWriter _logFile = null;
        private String _filename = "";
		
		public bool EnableLogging {get; set;}
	
		public LogFile(string filename)
		{
			EnableLogging = false;
            _filename = filename;
		}
		
		public void WriteLine(string text)
		{
			if (EnableLogging)
			{
                if (_logFile == null)
                {
                    _logFile = new StreamWriter(_filename, true);
                }

				_logFile.WriteLine(DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss:fff - ") + text);
				_logFile.Flush();
			}
		}
	}
}
